package com.lipaluma.parser.marshalling;

import java.util.ArrayList;
import java.util.List;

import com.lipaluma.field.mapper.mapping.MappingInfo;


public class ObjectMarshalled {

	private List<FieldMarshalled> fieldsMarshalled = new ArrayList<FieldMarshalled>();
	private List<List<ObjectMarshalled>> oneToManyFieldsMarshalled = new ArrayList<List<ObjectMarshalled>>();
	
	public void addValueMarshalledOnMapping(MappingInfo mapping, Object value) {
		fieldsMarshalled.add(new FieldMarshalled(mapping, value));
	}
	
	public void addObjectMarshalledValuesForField(List<ObjectMarshalled> valuesOfOneToManyField) {
		oneToManyFieldsMarshalled.add(valuesOfOneToManyField);
	}
	
	public List<FieldMarshalled> getFieldsMarshalled() {
		return fieldsMarshalled;
	}
	
	public List<List<ObjectMarshalled>> getOneToManyFieldsMarshalled() {
		return oneToManyFieldsMarshalled;
	}
	
	public void copy(ObjectMarshalled source) {
		this.fieldsMarshalled.addAll(source.fieldsMarshalled);
		this.oneToManyFieldsMarshalled.addAll(source.oneToManyFieldsMarshalled);
	}
}
